import { useRef, useEffect } from 'react';
import { Comment } from '../10-评论列表V5/Comment';

export const App = () => {
  // 创建DOM容器变量
  const inputRef = useRef(null);
  const commentRef = useRef(null);

  // 组件渲染完成后
  useEffect(() => {
    inputRef.current.focus();
  }, []);

  return (
    <div>
      <input type="text" ref={inputRef}></input>
      {/* <input type="submit"></input> */}
      <button
        onClick={() => {
          console.log(commentRef.current.state);
        }}
      >
        按钮
      </button>
      <Comment ref={commentRef} />
    </div>
  );
};
